<div id="wrapper" style="height:420px;">
<div id="contenido">
<?php if ($error) { ?>
<div class="warning"><?php echo $error; ?></div>
<?php } ?>
<div class="heading"><?php echo $heading_title; ?></div>
<div class="description"><?php echo $heading_description; ?></div>
<script type="text/javascript" src="javascript/tab/tab.js"></script>
<link rel="stylesheet" type="text/css" href="javascript/tab/tab.css" />
<script type="text/javascript" src="javascript/fckeditor/fckeditor.js"></script>

<script type="text/javascript" src="javascript/greybox/AJS.js"></script>
<script type="text/javascript" src="javascript/greybox/AJS_fx.js"></script>
<script type="text/javascript" src="javascript/greybox/gb_scripts.js"></script>

<script type="text/javascript" src="javascript/ajax/jquery.js"></script>

<link href="javascript/greybox/gb_styles.css" rel="stylesheet" type="text/css" />

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form" name="form">
  <div class="tab" id="tab">
    <div class="tabs"><a><?php echo $tab_general; ?></div>
    <div class="pages">
      <div class="page">
        <div class="pad">
          <table>
            <tr>
	          <td width="185"><span class="required">*</span> <?php echo $entry_comision; ?></td>
              <td>
              
              <?php
              	 if ($_REQUEST['action'] == 'update') { ?> 
              	 <input type="text" name="cod_comision" value="<?php echo $cod_comision; ?>" readonly/>
               <?php } 
               	else
               	{
                    $conexion = mysql_connect('localhost', 'root', '');
                    mysql_select_db("mcga",$conexion);
                    if (!$conexion) {
                            die('No se puedo conectar al servidor MySQL: ' . mysql_error());
                    }
                    $resultado = mysql_query("SHOW TABLE STATUS FROM mcga LIKE 'comisiones'");
                    $codComi = mysql_fetch_object($resultado);
                    mysql_free_result($resultado);
               ?>
               
              	<input type="text" name="cod_comision" value='<?php echo $codComi->Auto_increment; ?>'  readonly/>
              <?php } ?> 
                <?php if ($error_cod_comision) { ?>
                <span class="error"><?php echo $error_cod_comision; ?></span>
                <?php } ?></td>
           </tr>            
            <tr>
	          <td width="185"><span class="required">*</span> <?php echo $entry_descripcion; ?></td>
              <td><input type="text" name="descripcion" value="<?php echo $descripcion; ?>" size="50" autocomplete='off' />
                <?php if ($error_descripcion) { ?>
                <span class="error"><?php echo $error_descripcion; ?></span>
                <?php } ?></td>
           </tr>
            <tr>
	          	<td width="185"><span class="required">*</span> <?php echo $entry_cod_materia; ?></td>	
    			<td>
                	<select name="cod_materia">
                    	<option value="0">Seleccione</option>
                        <?php 
                        foreach ($materias as $p)
                        { 
                        	if ($p['cod_materia'] == $cod_materia)
                            {
                        ?>
                        	<option value="<?php echo $p['cod_materia']; ?>" selected> <?php echo $p['descripcion'];?></option>
                        <?php                        	
                        	}
                            else
                            {
                            ?>
                               <option value="<?php echo $p['cod_materia']; ?>"> <?php echo $p['descripcion'];?></option>
                            <?php
                            }
                        }
                        ?>
                    </select>
                      <?php if ($error_cod_materia) { ?>
                <span class="error"><?php echo $error_cod_materia; ?></span>
                <?php } ?>
                </td>        		
            </tr> 
            <tr>
	          <td width="185"><span class="required">*</span> <?php echo $entry_cupomaximo; ?></td>
              <td><input type="text" name="cupomaximo" value="<?php echo $cupomaximo; ?>" size="50" autocomplete='off' />
                <?php if ($error_cupomaximo) { ?>
                <span class="error"><?php echo $error_cupomaximo; ?></span>
                <?php } ?></td>
           </tr>
          </table>
        </div>
      </div>
    </div>            
  </div>
 <div class="task">
  <div class="enabled" onmouseover="className='hover'" onmouseout="className='enabled'" onclick="document.getElementById('form').submit();"><img src="template/default/image/save_enabled.png" alt="<?php echo $button_save; ?>" class="png" /><?php echo $button_save; ?></div>
  <div class="enabled" onmouseover="className='hover'" onmouseout="className='enabled'" onclick="location='<?php echo $cancel; ?>'"><img src="template/default/image/cancel_enabled.png" alt="<?php echo $button_cancel; ?>" class="png" /><?php echo $button_cancel; ?></div>
</div>

  <script type="text/javascript"><!--
  tabview_initialize('tab');
  //--></script>
</form>
</div>
</div>